package com.ghpt.controller;
import com.ghpt.pojo.QingCN;
import com.ghpt.service.QingCNService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/qingcn")
public class QingCNController {
    private final QingCNService qingCNService;

    public QingCNController(QingCNService qingCNService) {
        this.qingCNService = qingCNService;
    }
    @GetMapping("/{id}")
    public QingCN getQingCNById(@PathVariable Long id) {
        System.out.println("结果是"+qingCNService.findQingCNById(id));
        return qingCNService.findQingCNById(id);
    }
    @PutMapping
    public int updateQingCN(@RequestBody QingCN qingCN) {
        return qingCNService.updateById(qingCN);
    }
}
